<HTML><HEAD><TITLE>breal_from_bounds(+Lo, +Hi, -Result)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Arithmetic</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>breal_from_bounds(+Lo, +Hi, -Result)</H1>
Constructs a bounded real from the given floating point bounds
<DL>
<DT><EM>Lo</EM></DT>
<DD>A number.
</DD>
<DT><EM>Hi</EM></DT>
<DD>A number.
</DD>
<DT><EM>Result</EM></DT>
<DD>A variable.
</DD>
</DL>
<H2>Description</H2>
    This predicate is used by the ECLiPSe compiler to expand evaluable
    arithmetic expressions.  So a call to breal_from_bounds(Lo, Hi, Result)
    is equivalent to
<PRE>
    Result is breal_from_bounds(Lo, Hi).
</PRE>
    This predicate constructs a new bounded real number with the specified
    bounds. In effect, the bounds are first cast to bounded reals, and then
    the new bounded real is constructed from the lower bound of Lo and the
    upper bound of Hi.
<P>

<H3>Modes and Determinism</H3><UL>
<LI>breal_from_bounds(+, +, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Lo or Hi are not instantiated.
<DT><EM>(20) arithmetic exception </EM>
<DD>The lower bound of Lo is greater than the upper bound of Hi.
<DT><EM>(24) number expected </EM>
<DD>Lo or Hi are not numbers.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      ?- breal_from_bounds(0.99, 1.01, X).
      X = 0.99__1.01

      ?- breal_from_bounds(1_3, 2_3, X).
      X = 0.33333333333333326__0.66666666666666674

Error:
      ?- breal_from_bounds(1, H, X).
      instantiation fault in breal_from_bounds(1, H, X)

      ?- breal_from_bounds("a", 2.0, X).
      number expected in breal_from_bounds("a", 2.0, X)

      ?- breal_from_bounds(2 + 4, 3 + 5, Z).
      number expected in breal_from_bounds(2 + 4, 3 + 5, Z)

      ?- breal_from_bounds(1.0, 2.0, 1.0__2.0).
      type error in breal_from_bounds(1.0, 2.0, 1.0__2.0)

      ?- breal_from_bounds(1.1, 0.9, X).
      arithmetic exception in breal_from_bounds(1.1, 0.9, X)
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/arithmetic/breal_min-2.html">breal_min / 2</A>, <A HREF="../../kernel/arithmetic/breal_max-2.html">breal_max / 2</A>, <A HREF="../../kernel/typetest/breal-1.html">breal / 1</A>, <A HREF="../../kernel/arithmetic/breal-2.html">breal / 2</A>, <A HREF="../../kernel/arithmetic/breal_bounds-3.html">breal_bounds / 3</A>, <A HREF="../../kernel/arithmetic/is-2.html">is / 2</A>
</BODY></HTML>
